home *** CD-ROM | disk | FTP | other *** search
/ WWW Studio 2004 / WWW Studio.iso / Programy / Demo / angielskidemo_setup.exe / #setuppath# / 6.dxr / 00022_Text button (modif).ls < prev    next >
Encoding:
Text File  |  2004-02-01  |  1.8 KB  |  92 lines

  1. property prActionW, prActionP, Active, mytype, mySprite, prbuttontype, button_entered, Paction_done
  2. global timebuffer2
  3.  
  4. on beginSprite me
  5.   button_entered = 0
  6.   Active = 0
  7.   mySprite = sprite(me.spriteNum)
  8.   case mySprite.member.type of
  9.     #field:
  10.       mytype = 1
  11.     #text:
  12.       mytype = 2
  13.     otherwise:
  14.       alert("Text Button - z┬│y typ membera")
  15.   end case
  16. end
  17.  
  18. on mouseEnter
  19.   cursor(-1)
  20.   timebuffer2 = the timer
  21.   button_entered = -1
  22.   Paction_done = 0
  23. end
  24.  
  25. on mouseLeave me
  26.   setcursor(#CursorNormal)
  27.   if Active then
  28.     Active = 0
  29.   end if
  30. end
  31.  
  32. on mouseDown me
  33.   Active = getactive(me)
  34. end
  35.  
  36. on getactive me
  37.   case mytype of
  38.     1:
  39.       case prbuttontype of
  40.         #line:
  41.           return the mouseLine
  42.         #word:
  43.           return the mouseWord
  44.         #char:
  45.           return the mouseChar
  46.       end case
  47.     2:
  48.       v = getAt(the mouseLoc, 2) - mySprite.locV
  49.       return locVToLinePos(mySprite.member, v)
  50.   end case
  51. end
  52.  
  53. on mouseUp me
  54.   Current = getactive(me)
  55.   if Active > 0 then
  56.     if Current = Active then
  57.       do(prActionW)
  58.     end if
  59.   end if
  60.   Active = 0
  61. end
  62.  
  63. on mouseWithin me
  64.   if the mouseDown then
  65.     exit
  66.   end if
  67.   if prActionP <> EMPTY then
  68.     Current = getactive(me)
  69.     if button_entered <> Current then
  70.       timebuffer2 = the timer
  71.       button_entered = Current
  72.       Paction_done = 0
  73.     end if
  74.     if abs(the timer - timebuffer2) < 20 then
  75.       exit
  76.     end if
  77.     if not Paction_done then
  78.       Paction_done = 1
  79.       do(prActionP)
  80.     end if
  81.   end if
  82. end
  83.  
  84. on mouseUpOutSide
  85.   setcursor(#CursorNormal)
  86.   Active = 0
  87. end
  88.  
  89. on getPropertyDescriptionList
  90.   return [#prActionP: [#comment: "ActionP:", #default: EMPTY, #format: #string], #prActionW: [#comment: "ActionW:", #default: EMPTY, #format: #string], #prbuttontype: [#comment: "akcja na:", #default: #line, #format: #symbol, #range: [#word, #line, #char]]]
  91. end
  92.